package com.zhiwang.planet.ui.my.message

import android.os.Bundle
import androidx.databinding.DataBindingUtil
import com.zhiwang.planet.R
import com.zhiwang.planet.databinding.ActivityMessageBinding
import com.zhiwang.planet.di.component.DaggerUserComponent
import com.zhiwang.planet.di.module.AccountModule
import com.zhiwang.planet.di.module.AutoDisposeModule
import com.zhiwang.planet.mvvm.viewmodel.main.MessageViewModel
import com.zhiwang.planet.ui.BaseActivity
import javax.inject.Inject

class MessageActivity : BaseActivity() {


    @Inject
    lateinit var messageViewModel: MessageViewModel


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = DataBindingUtil.setContentView<ActivityMessageBinding>(this, R.layout.activity_message)
        binding.viewModel = messageViewModel
        binding.lifecycleOwner = this
        messageViewModel.lifeCycleOwner = this.lifecycle
        messageViewModel.start()

    }

    override fun initInjection() {
        super.initInjection()
        DaggerUserComponent.builder()
                .accountModule(AccountModule(this))
                .autoDisposeModule(AutoDisposeModule(this))
                .appComponent(getAppComponent())
                .build()
                .inject(this)
    }
}
